//
//  ExaminationTableViewCell.m
//  SafeFoodManagerDemo
//
//  Created by ios-1 on 2018/3/6.
//  Copyright © 2018年 bob. All rights reserved.
//

#import "ExaminationTableViewCell.h"

@implementation ExaminationTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)refreshDetailData:(AcountInDetails*)data;
{
    self.titleLab.text = data.goodsName;
    self.nameLab.text = [NSString stringWithFormat:@"单价:￥%@/%@",data.price,data.unit];
    
    self.timeLab.text = [NSString stringWithFormat:@"数量:%.2f",data.quantity.floatValue];
    self.sumLabel.text =[NSString stringWithFormat:@"小计:%.2f元",data.quantity.floatValue*data.price.floatValue];
    
    [self.statueBtn setImage:[UIImage imageNamed:@"groupA"] forState:UIControlStateNormal];
    [self.statueBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    [self.statueBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 30, 0, 0)];
    
    [self.statueBtn setTitle:@"" forState:UIControlStateNormal];
    self.scoreLab.hidden = YES;
}
- (void)refreshData:(ExaminationPaperData*)data;
{
    self.titleLab.text = [NSString stringWithFormat:@"%@",data.examName];
    if([LoginStatuesModel getUserType] == 2)
    {
        self.nameLab.text = [NSString stringWithFormat:@"阅卷人:%@",(data.markName!=nil)?(data.markName):@"暂无"];
    }else{
        self.nameLab.text = [NSString stringWithFormat:@"考生:%@",(data.answerName!=nil)?(data.answerName):@"暂无"];
    }
    
    self.timeLab.text = [NSString stringWithFormat:@"考试时间:%@",data.addDate];
    
    if(data.isAnswer.integerValue == 0)//未交卷
    {
        self.scoreLab.hidden = YES;
        [self.statueBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
        [self.statueBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
        [self.statueBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
        
        [self.statueBtn setTitle:@"未交卷" forState:UIControlStateNormal];
    
    }else if(data.isAnswer.integerValue == 1)//已交卷
    {
        if(data.isMark == 0)//未阅卷
        {
            self.scoreLab.hidden = YES;
            [self.statueBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
            [self.statueBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
            [self.statueBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
            
            [self.statueBtn setTitle:@"未阅卷" forState:UIControlStateNormal];
        }else if (data.isMark == 1)//已阅卷
        {
            self.scoreLab.hidden = NO;
            self.scoreLab.text = [NSString stringWithFormat:@"%ld",data.totalScore];
            
            [self.statueBtn setImage:[UIImage imageNamed:@"exam_score_icon"] forState:UIControlStateNormal];
            self.statueBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
            [self.statueBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 20, 0)];
            [self.statueBtn setImageEdgeInsets:UIEdgeInsetsMake(30, 10, 0, 0)];
        }
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
